﻿using Face8280WebSocketServer.DB.Device;
using Face8280WebSocketServer.DB.Log;
using Face8280WebSocketServer.DB.People;
using Face8280WebSocketServer.DB.Record;
using Face8280WebSocketServer.DB.System;
using Face8280WebSocketServer.DB.TimeGroup;
using Face8280WebSocketServer.DB.UI;
using Face8280WebSocketServer.DB.User;
using Face8280WebSocketServer.Model;
using Face8280WebSocketServer.Model.People;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;

namespace Face8280WebSocketServer.DB
{
    public class FaceDBContext : DbContext
    {
        private ILogger<FaceDBContext> _logger;
        private static string connectionString;
        public FaceDBContext(DbContextOptions<FaceDBContext> Options, ILogger<FaceDBContext> logger) : base(Options)
        {
            _logger = logger;
            //_logger.LogInformation("创建一个 FaceDBContext");
            //string sFile = Path.Combine(Directory.GetCurrentDirectory(), "DB", "FC8280Server.DB");
            //connectionString = $"Filename={sFile}";
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {   
           // optionsBuilder.UseSqlite(connectionString);
        }


        /// <summary>
        /// 人脸机记录表
        /// </summary>
        public DbSet<DriveRecord> FaceRecord { get; set; }

        public DbSet<NewModel.Device.FaceDeviceDetailNew> FaceDeviceNew { get; set; }

        /// <summary>
        /// 人脸机人员
        /// </summary>
        public DbSet<FacePeople> FacePeople { get; set; }

        /// <summary>
        /// 人脸机设备
        /// </summary>
        public DbSet<FaceDeviceDetail> FaceDevice { get; set; }

        public DbSet<FaceIOLog> FaceIOLog { get; set; }
        public DbSet<FaceDeviceInfo> FaceDeviceInfo { get; set; }

        /// <summary>
        /// 界面UI菜单
        /// </summary>
        public DbSet<SystemMenuEntity> SystemMenus { get; set; }

        /// <summary>
        /// 网站管理员
        /// </summary>
        public DbSet<UserDetail> User { get; set; }

        /// <summary>
        /// 用户日志
        /// </summary>
        public DbSet<UserLogModel> UserLog { get; set; }

        public DbSet<FaceRecordInfo> FaceRecordInfo { get; set; }

        public DbSet<FacePeopleInfo> FacePeopleInfo { get; set; }

        /// <summary>
        /// 系统参数 键值对
        /// </summary>
        public DbSet<SystemKV> SystemKV { get; set; }

        /// <summary>
        /// 人脸机网络连接日志
        /// </summary>
        public DbSet<ConnectIOLog> ConnectIOLog { get; set; }

        /// <summary>
        /// 人员权限
        /// </summary>
        public DbSet<FacePeopleAccessDetail> FacePeopleAccessDetail { get; set; }

        
        /// <summary>
        /// 远程任务
        /// </summary>
        public DbSet<RemoteTaskDetail> RemoteTaskDetail { get; set; }


        /// <summary>
        /// 开门时段
        /// </summary>
        public DbSet<TimeGroupDetail> TimeGroupDetail { get; set; }

        public DbSet<FacePeopleTest> FacePeopleTest { get; set; }
        

    }
}
